//
//  FirstPageWillSaleRequest.m
//  BSLCar
//
//  Created by 梁毅 on 15/5/24.
//  Copyright (c) 2015年 lyz. All rights reserved.
//

#import "FirstPageWillSaleRequest.h"

@implementation FirstPageWillSaleRequest
- (NSArray *)getParserResult
{
    NSString *str = @"http://baojia.qichecdn.com/priceapi3.9.2/services/upcomingsales/get";
    str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url = [NSURL URLWithString:str];
    NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60];
    self.dataArray = [NSMutableArray array];
    NSError *error = nil;
   NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&error];
    if (!error) {
        NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
        
        NSDictionary *dic1 = [dic objectForKey:@"result"];
        NSArray *array = [dic1 objectForKey:@"serieslist"];
        for (NSDictionary *dic2 in array) {
            FPWillSaleModel *model = [FPWillSaleModel getWillSaleModel];
            model.name = [dic2 objectForKey:@"name"];
            model.price = [dic2 objectForKey:@"price"];
            model.selltime = [dic2 objectForKey:@"selltime"];
            model.newstitle = [dic2 objectForKey:@"newstitle"];
            model.imgurl = [dic2 objectForKey:@"imgurl"];
            model.newsurl = [dic2 objectForKey:@"newsurl"];
            model.id1 = [[dic2 objectForKey:@"id"]integerValue];
            //   NSLog(@"%@", model.newstitle);
            [self.dataArray addObject:model];
    }
        //字典里数组，数组里字典
        
    }
    return self.dataArray;
}

@end
